<?php
/**
 * Nadëb (Makú-Nadëb)
 *
 * @filesource 
 * @copyright  Copyright 2010 mateusweb.com.br
 * @license    Freeware
 * @package    Nadeb_Data_Grid
 * @subpackage Nadeb.Grid.Controlles
 * @version    1.0
 */

class Nadeb_Grid_Controllers extends Nadeb_Grid_Sql
{
	/*
	 * Public Vars
	 */

	/*
	 * Protected Vars
	 */
	
	/*
	 * Private Vars
	 */
	private $boots = array(
		"Adicionar" => "adicionar",
		"Deletar"   => "deletar"
	);
	private $quickBoots = array(
		"[Edit]"  => "editar",
		"[Del]"   => "deletar"
	);
	
	/*
	 * 
	 */
	private function set_url()
	{
		$url  = Zend_Registry::get("baseUrl") . "/";
		$url .= $this->allParams["module"] . "/";
		$url .= $this->allParams["controller"] . "/";
		
		return $url;
	}
	
	/**
	 * Retorna uma nova configuração de botões para a barra superior
	 * 
	 * @example array("rotulo" => "action")
	 * @param $boots
	 * @return $boots
	 * 
	 */
	public function set_boots($boot)
	{
		return $this->boots = $boot;
	}
	
	/*
	 * 
	 */
	public function get_boots()
	{
		$gd  = "\t\t\t\t<tr>\n";
		$gd .= "\t\t\t\t\t<th class=\"th_boots\" colspan=\"99\">\n";
		foreach($this->boots as $rotulo => $action)
			$gd .= "\t\t\t\t\t\t<a href=\"{$this->set_url()}{$action}/\"><input type=\"button\" value=\"{$rotulo}\" /></a>\n";
		$gd .= "\t\t\t\t\t</th>\n";
		$gd .= "\t\t\t\t</tr>\n";
		
		return $gd;
	}
	
	/*
	 * 
	 */
	public function get_quickBoots($_id)
	{
		$gd = "";
		foreach($this->quickBoots as $rotulo => $action)
			$gd .= "\n\t\t\t\t\t\t<a href=\"{$this->set_url()}{$action}/id/{$_id}\">{$rotulo}</a>";
		
		return $gd;
	}	

}
